{% extends "horizon/common/_modal_form.html" %}

{% load i18n %}

{% block form_name %}metadataForm{% endblock %}
{% block form_validation %}novalidate{% endblock %}
{% block ng_controller %}hzModalFormUpdateMetadataCtrl{% endblock %}

{% block modal-body %}
  <hz-metadata-tree available="available"
                    existing="existing"
                    model="tree"></hz-metadata-tree>
  <script type="text/javascript">
    var existing_metadata = JSON.parse('{{ existing_metadata|escapejs }}');
    var available_metadata = JSON.parse('{{ available_metadata|escapejs }}');
  </script>
{% endblock %}

{% block modal-footer %}
  <div>
    <input class="btn btn-primary pull-right"
           ng-disabled="metadataForm.$invalid"
           ng-click="saveMetadata()" type="submit"
           value="{% trans "Save" %}"/>
    <a class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
    <input type="hidden" name="metadata" ng-value="metadata"
           ng-model="metadata">
  </div>
{% endblock %}
